package com.cloudsense.ftestm.controller;



import com.cloudsense.ftestm.model.User;
import com.cloudsense.ftestm.pojo.UserOperationResult;
import com.cloudsense.ftestm.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping("/adduser")
    public @ResponseBody UserOperationResult adduser(HttpServletRequest request, User user){

        userService.addUser(user);

        return UserOperationResult.build(0,"add user succeed ",null);
    }

}
